<?php 
require_once('Connections/tecno.php'); 
session_start();

$id = $_REQUEST['id'];
$ci = $_REQUEST['cedula'];

mysql_select_db($database_tecno, $tecno); 

$query_buscar = "SELECT * FROM detallescliente WHERE id = '$id'";
$buscar = mysql_query($query_buscar, $tecno) or die(mysql_error());
$row_buscar = mysql_fetch_assoc($buscar);
$totalRows_buscar = mysql_num_rows($buscar);
if($totalRows_buscar>0){
do {

$query_eliminar = "DELETE FROM contratos WHERE idContrato = ".$row_buscar['idContrato'];
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

	
}while ($row_buscar = mysql_fetch_assoc($buscar));
}

$query_eliminar = "DELETE FROM detallescliente WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());


$query_eliminar = "DELETE FROM datospersonales WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

$query_eliminar = "DELETE FROM inflaboral WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

$query_eliminar = "DELETE FROM pagos WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

$query_eliminar = "DELETE FROM pagos1 WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

$query_eliminar = "DELETE FROM refcomerciales WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());


$query_eliminar = "DELETE FROM refpersonal WHERE id = '$id'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());

$query_eliminar = "DELETE FROM usuarios WHERE usuario = '$ci'";
$buscar = mysql_query($query_eliminar, $tecno) or die(mysql_error());


?>
<?php echo "3"; ?>
